﻿@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <script type="text/javascript">
        var wireTransfer, remittanceAccount, cryptoCurrency;
        var fromCurrency, depositCurrency
        var price
        var renderTable;
        var userType = 0;
        var $;
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            treetable: 'treetable-lay/treetable',
            index: 'lib/index'
        }).use(['table', 'form', 'treetable', 'index', 'laydate'], function () {
            $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , element = layui.element
                , laydate = layui.laydate
                , treetable = layui.treetable;
            top.SetListPageLanguage(layui);

            //日期范围
            laydate.render({
                elem: '#depositChangeTime'
                , range: true
            });

            //日期范围
            laydate.render({
                elem: '#withdrawalChangeTime'
                , range: true
            });

            //日期范围
            laydate.render({
                elem: '#internalTransferChangeTime'
                , range: true
            });

            //操作类型
            $.getJSON("/Assets/GetCode?type=status", function (result) {
                $('#depositState').append(new Option(top.lang.pleaseSelect, ""));
                $('#withdrawalState').append(new Option(top.lang.pleaseSelect, ""));
                $('#internalTransferState').append(new Option(top.lang.pleaseSelect, ""));
                let plat = result.data;
                plat.forEach(function (v) {
                    for (var key in top.lang) {
                        if (top.lang.hasOwnProperty(key)) {
                            if (key === v.remark) {
                                var text = top.lang[key];
                                $('#depositState').append(new Option(text, v.code));
                                $('#withdrawalState').append(new Option(text, v.code));
                                $('#internalTransferState').append(new Option(text, v.code));
                            }
                        }
                    }
                });
                layui.form.render("select");
            });

            //入金-操作方式
            $.getJSON("/Assets/GetCode?type=depositMethod", function (result) {
                $('#depositMethod').append(new Option(top.lang.pleaseSelect, ""));
                let plat = result.data;
                plat.forEach(function (v) {
                    for (var key in top.lang) {
                        if (top.lang.hasOwnProperty(key)) {
                            if (key === v.remark) {
                                var text = top.lang[key];
                                $('#depositMethod').append(new Option(text, v.code));
                            }
                        }
                    }
                });
                layui.form.render("select");
            });

            // 渲染表格
            depositTable = function () {
                table.render({
                    elem: '#deposit-datalist'
                    , url: '/Assets/GetDeposit'
                    , limit: 20
                    , cols: [[
                        //{ field: 'index', title: '序号', type: 'numbers', width: 60, templet: '#depositZiZeng' }
                        { field: 'orderNumber', title: '订单号', width: 180 }
                        , {
                            field: 'operationMode', title: '操作方式', templet: function (res) {
                                if (res.operationMode == 1) {
                                    return '<span lay-event="wireTransfer"></span>';
                                }
                                else if (res.operationMode == 2) {
                                    return '<span lay-event="remittanceAccount"></span>';
                                }
                                else if (res.operationMode == 3) {
                                    return '<span lay-event="cryptoCurrency"></span>';
                                }
                            }
                        }
                        , {
                            field: 'state', title: '状态', templet: function (res) {
                                switch (res.state) {
                                    case 0: return "<span class='layui-btn layui-btn-primary layui-btn-xs' lay-event='inReview' />"; break;
                                    case 2: return "<span class='layui-btn layui-btn-xs' lay-event='pass' />"; break;
                                    case 1: return "<span class='layui-btn layui-btn-danger layui-btn-xs' lay-event='refuse' />"; break;
                                }
                            }
                        }
                        , { field: 'fromAmount', title: '充值金额' }
                        , { field: 'toAmount', title: '实充金额' }
                        , { field: 'fees', title: '手续费' }
                        , { field: 'createDate', title: '提交时间', width: 180 }
                        , {
                            title: '充值凭证', field: 'certificate', align: 'center', width: 130,
                            templet: function dataUrl(d) {
                                var img = "<img src='" + d.certificate + "' onclick='imgcli(this)'>";
                                return img;
                            }
                        }
                        , { field: 'remark', title: '充值备注' }
                        , { field: 'reviewer', title: '当前审核人' }
                        , { field: 'overDate', title: '完结时间', width: 180 }
                        , { field: 'aduitRemark', title: '审核备注' }
                        //, { field: 'operate', fixed: 'right', title: '操作', toolbar: '#deposit-datalist-bar' }
                    ]]
                    , id: "depositTable"
                    , defaultToolbar: false
                    , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                        /**多语言初始化 */
                        top.SetListPageLanguage(layui);
                        layui.form.render("select");
                    }
                });
            };
            depositTable();
            //查询
            form.on('submit(depositSearch)', function (data) {
                //执行重载
                table.reload('depositTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        operationMode: $("#depositMethod option:selected").val(),
                        state: $("#depositState option:selected").val(),
                        orderNumber: $("#depositSerialNumber").val(),
                        createTime: $("#depositChangeTime").val()
                    }
                });
            });

            //重置
            form.on('submit(depositResetting)', function (data) {
                $("#depositMethod option:selected").val('')
                $("#depositState option:selected").val('')
                $("#depositSerialNumber").val('')
                $("#depositChangeTime").val('')
                //执行重载
                table.reload('depositTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        operationType: "",
                        state: "",
                        orderNumber: "",
                        createTime: "",
                    }
                });
            });

            //出金-操作方式
            $.getJSON("/Assets/GetCode?type=withdrawalMethod", function (result) {
                $('#withdrawalMethod').append(new Option(top.lang.pleaseSelect, ""));
                let plat = result.data;
                plat.forEach(function (v) {
                    for (var key in top.lang) {
                        if (top.lang.hasOwnProperty(key)) {
                            if (key === v.remark) {
                                var text = top.lang[key];
                                $('#withdrawalMethod').append(new Option(text, v.code));
                            }
                        }
                    }
                });
                layui.form.render("select");
            });

            // 渲染表格
            withdrawalTable = function () {
                table.render({
                    elem: '#withdrawal-datalist'
                    , url: '/Assets/GetWithdrawal'
                    , limit: 20
                    , cols: [[
                        //{ field: 'index', title: '序号', type: 'numbers', width: 60, templet: '#depositZiZeng' }
                        { field: 'orderNumber', title: '订单号', width: 180 }
                        , {
                            field: 'operationMode', title: '操作方式', templet: function (res) {
                                if (res.operationMode == 1) {
                                    return '<span lay-event="wireTransfer"></span>';
                                }
                                else if (res.operationMode == 2) {
                                    return '<span lay-event="remittanceAccount"></span>';
                                }
                                else if (res.operationMode == 3) {
                                    return '<span lay-event="cryptoCurrency"></span>';
                                }
                            }
                        }
                        , {
                            field: 'state', title: '状态', templet: function (res) {
                                switch (res.state) {
                                    case 0: return "<span class='layui-btn layui-btn-primary layui-btn-xs' lay-event='inReview' />"; break;
                                    case 2: return "<span class='layui-btn layui-btn-xs' lay-event='pass' />"; break;
                                    case 1: return "<span class='layui-btn layui-btn-danger layui-btn-xs' lay-event='refuse' />"; break;
                                }
                            }
                        }
                        , {
                            field: 'applicationsAmount', title: '申请金额', templet: function (res) {
                                return res.fromAmount
                            }
                        }
                        , { field: 'withdrawalAmount', title: '实出金额' }
                        , { field: 'fees', title: '手续费' }
                        , { field: 'createDate', title: '提交时间', width: 180 }
                        , { field: 'remark', title: '备注信息' }
                        , { field: 'reviewer', title: '当前审核人' }
                        , { field: 'overDate', title: '完结时间', width: 180 }
                        , { field: 'aduitRemark', title: '审核备注' }
                    ]]
                    , id: "withdrawalTable"
                    , defaultToolbar: false
                    , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                        /**多语言初始化 */
                        top.SetListPageLanguage(layui);
                        layui.form.render("select");
                    }
                });
            };
            withdrawalTable();
            //查询
            form.on('submit(withdrawalSearch)', function (data) {
                //执行重载
                table.reload('withdrawalTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        operationMode: $("#withdrawalMethod option:selected").val(),
                        state: $("#withdrawalState option:selected").val(),
                        orderNumber: $("#withdrawalSerialNumber").val(),
                        createTime: $("#withdrawalChangeTime").val()
                    }
                });
            });

            //重置
            form.on('submit(withdrawalResetting)', function (data) {
                $("#withdrawalMethod option:selected").val('')
                $("#withdrawalState option:selected").val('')
                $("#withdrawalSerialNumber").val('')
                $("#withdrawalChangeTime").val('')
                //执行重载
                table.reload('withdrawalTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        operationType: "",
                        state: "",
                        orderNumber: "",
                        createTime: "",
                    }
                });
            });

            // 渲染表格
            internalTransferTable = function () {
                table.render({
                    elem: '#internalTransfer-datalist'
                    , url: '/Assets/GetInternalTransfer'
                    , limit: 20
                    , cols: [[
                        { field: 'orderNumber', title: '订单号', width: 180 }
                        , {
                            field: 'state', title: '状态', templet: function (res) {
                                switch (res.state) {
                                    case 0: return "<span class='layui-btn layui-btn-primary layui-btn-xs' lay-event='inReview' />"; break;
                                    case 2: return "<span class='layui-btn layui-btn-xs' lay-event='pass' />"; break;
                                    case 1: return "<span class='layui-btn layui-btn-danger layui-btn-xs' lay-event='refuse' />"; break;
                                }
                            }
                        }
                        , { field: 'transferOutAmount', title: '充值金额' }
                        , { field: 'receivedAmount', title: '实充金额' }
                        , { field: 'fees', title: '手续费' }
                        , { field: 'createDate', title: '提交时间', width: 180 }
                        , { field: 'remark', title: '备注信息' }
                        , { field: 'reviewer', title: '当前审核人' }
                        , { field: 'overDate', title: '完结时间', width: 180 }
                        , { field: 'aduitRemark', title: '审核备注' }
                    ]]
                    , id: "internalTransferTable"
                    , defaultToolbar: false
                    , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                        /**多语言初始化 */
                        top.SetListPageLanguage(layui);
                        layui.form.render("select");
                    }
                });
            };
            internalTransferTable();
            //查询
            form.on('submit(internalTransferSearch)', function (data) {
                //执行重载
                table.reload('internalTransferTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        state: $("#internalTransferState option:selected").val(),
                        orderNumber: $("#internalTransferSerialNumber").val(),
                        createTime: $("#internalTransferChangeTime").val()
                    }
                });
            });

            //重置
            form.on('submit(internalTransferResetting)', function (data) {
                $("#internalTransferState option:selected").val('')
                $("#internalTransferSerialNumber").val('')
                $("#internalTransferChangeTime").val('')
                //执行重载
                table.reload('internalTransferTable', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        operationType: "",
                        state: "",
                        orderNumber: "",
                        createTime: "",
                    }
                });
            });
        });

        function imgcli(obj) {
            previewImg(obj)
        }
    </script>
}
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body" style="padding:0;">
                        <div class="layui-tab layui-tab-brief" lay-filter="deposit">
                            <ul class="layui-tab-title">
                                <li lay-event="depositReview" class="layui-this">充值审核</li>
                                <li lay-event="withdrawalReview">提现审核</li>
                                <li lay-event="internalTransferReview">内部转账审核</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <div class="layui-card" lay-filter="component-form-element">
                                        <div class="layui-card-body layui-form layui-form-pane" style="padding:0;">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="operationType">操作类型</label>
                                                    <div class="layui-input-inline">
                                                        <select name="depositMethod" id="depositMethod">
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="state">状态</label>
                                                    <div class="layui-input-inline">
                                                        <select name="depositState" id="depositState">
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="orderNumber">订单号</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" id="depositSerialNumber" name="depositSerialNumber" placeholder="orderNumber" class="layui-input">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="changeTime">变动时间</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" class="layui-input" id="depositChangeTime" name="depositChangeTime" placeholder="changeTime" lay-key="8">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline">
                                                        <button class="layui-btn" lay-submit lay-filter="depositSearch" lay-event="depositSearch">搜索</button>
                                                        <button class="layui-btn layui-btn-primary" lay-submit lay-filter="depositResetting" lay-event="depositResetting">重置</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-card">
                                        <div class="layui-card-body" style="padding:0;">
                                            <div class="layui-tab-content" style="padding:0;">
                                                <table class="layui-hide" id="deposit-datalist" lay-filter="deposit-datalist"></table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div class="layui-card" lay-filter="component-form-element">
                                        <div class="layui-card-body layui-form layui-form-pane" style="padding:0;">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="operationType">操作类型</label>
                                                    <div class="layui-input-inline">
                                                        <select name="withdrawalMethod" id="withdrawalMethod">
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="state">状态</label>
                                                    <div class="layui-input-inline">
                                                        <select name="withdrawalState" id="withdrawalState">
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="orderNumber">订单号</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" id="withdrawalSerialNumber" name="withdrawalSerialNumber" placeholder="orderNumber" class="layui-input">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="changeTime">变动时间</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" class="layui-input" id="withdrawalChangeTime" name="withdrawalChangeTime" placeholder="changeTime" lay-key="8">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline">
                                                        <button class="layui-btn" lay-submit lay-filter="withdrawalSearch" lay-event="search">搜索</button>
                                                        <button class="layui-btn layui-btn-primary" lay-submit lay-filter="withdrawalResetting" lay-event="resetting">重置</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-card">
                                        <div class="layui-card-body" style="padding:0;">
                                            <div class="layui-tab-content" style="padding:0;">
                                                <table class="layui-hide" id="withdrawal-datalist" lay-filter="withdrawal-datalist"></table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div class="layui-card" lay-filter="component-form-element">
                                        <div class="layui-card-body layui-form layui-form-pane" style="padding:0;">
                                            <div class="layui-form-item">
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="state">状态</label>
                                                    <div class="layui-input-inline">
                                                        <select name="internalTransferState" id="internalTransferState">
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="orderNumber">订单号</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" id="internalTransferSerialNumber" name="internalTransferSerialNumber" placeholder="orderNumber" class="layui-input">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <label class="layui-form-label" lay-event="changeTime">变动时间</label>
                                                    <div class="layui-input-inline">
                                                        <input type="text" class="layui-input" id="internalTransferChangeTime" name="internalTransferChangeTime" placeholder="changeTime" lay-key="8">
                                                    </div>
                                                </div>
                                                <div class="layui-inline">
                                                    <div class="layui-input-inline">
                                                        <button class="layui-btn" lay-submit lay-filter="internalTransferSearch" lay-event="search">搜索</button>
                                                        <button class="layui-btn layui-btn-primary" lay-submit lay-filter="internalTransferResetting" lay-event="resetting">重置</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-card">
                                        <div class="layui-card-body" style="padding:0;">
                                            <div class="layui-tab-content" style="padding:0;">
                                                <table class="layui-hide" id="internalTransfer-datalist" lay-filter="internalTransfer-datalist"></table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>